<div class="block_time_ltd w640 left">
    <div class="left txt_gray">Lịch thi đấu tính theo giờ Việt Nam (GMT +7)</div>
    <div class="right">
        <div class="txt_paging_video">
            <span class="icon_portal_thethao icon_back_more">&nbsp;</span>
            <a href="javascript:;" onclick="fixture.changeDate('<?php echo date('Y-m-d', $this->prevUnixTime); ?>')" class="txt_gray">Quay lại </a>&nbsp; | &nbsp;
            <span class="txt_black_hover_blue"><b>
                    <?php
                    $day = date('N', $this->currUnixTime) + 1;
                    $date = date('d/m/Y', $this->currUnixTime);
                    if ($day == 8)
                        echo "Chủ nhật - $date";
                    else
                        echo "Thứ $day - $date";
                    ?>
                </b> 
            </span> &nbsp; | &nbsp;
            <a href="javascript:;" onclick="fixture.changeDate('<?php echo date('Y-m-d', $this->nextUnixTime); ?>')" class="txt_gray">Xem tiếp</a> <span class="icon_portal_thethao icon_view_more">&nbsp;</span>
        </div>
    </div>
    <div class="clear">&nbsp;</div>
</div>
<?php 
switch ($this->group)
{
    case NULL:
        $groupQT = isset($this->fixture[$this->groups[0]]) ? $this->fixture[$this->groups[0]] : NULL;
        $groupTN = isset($this->fixture[$this->groups[1]]) ? $this->fixture[$this->groups[1]] : NULL;
        break;
    case 'trong-nuoc':
        $groupQT = NULL;
        $groupTN = isset($this->fixture[$this->groups[1]]) ? $this->fixture[$this->groups[1]] : NULL;
        break;
    case 'quoc-te':
        $groupQT = isset($this->fixture[$this->groups[0]]) ? $this->fixture[$this->groups[0]] : NULL;
        $groupTN = NULL;
        break;
    default:
        break;
}

?>
<?php if ($this->group == NULL || $this->group == 'quoc-te'){ ?>
<div id="cate_lichthidau_bongdaqt" class="football box_width_common">
    <div class="title_cate">
        <p class="left">BÓNG ĐÁ QUỐC TẾ</p>
        <div class="right selec_cate">
            <select id="quoc-te" onchange="fixture.changeLeague(this.value, this.id);" class="left w150">
                <option value="0" <?php if($this->leagueId == 0) echo 'selected="selected"'; ?>>Tất cả giải đấu</option>
                <?php 
                if (is_array($this->arrListLeagueQT) && count($this->arrListLeagueQT)){
                foreach ($this->arrListLeagueQT as $leagueId => $leagueName){ ?>
                <option value="<?php echo $leagueId; ?>" <?php if($this->leagueId == $leagueId) echo 'selected="selected"'; ?>><?php echo $leagueName; ?></option>
                <?php }} ?>
            </select>
        </div>
    </div>
    <?php 
    if (is_array($groupQT) && count($groupQT)){
    foreach($groupQT as $group){?>
    <div class="content_cate">
        <div class="block_lichthidau box_width_common left">
            <div class="title_block">
                <div class="txt_title_left_block"><h3><a href="javascript:;" onclick="fixture.changeLeague(<?php echo $group['LeagueID']?>, 'quoc-te');" class="txt_black_hover_blue"><?php echo $group['Name'];?></a></h3></div>
                <div class="txt_view_more"><a class="txt_gray" href="<?php echo BASE_URL, '/bang-xep-hang/', Fpt_Filter::setSeoLink($group['Name']),'-', Fpt_Filter::setSeoLink($group['SeasonName']), '-', $group['LeagueID'], '-', $group['SeasonID'], '.html'?>">Bảng xếp hạng</a> <span class="icon_portal_thethao icon_view_more">&nbsp;</span></div>	
                <div class="clear">&nbsp;</div>  
            </div>
            <div class="content_block">
                <div class="main_content_block">
                    <div class="lichthidau_item box_width_common">
                        <ul class="list_capdau">
                            <?php 
                            $numMatches = count($group['arrMatches']);
                            for($i = 0; $i < $numMatches; $i++){
                                $match = $group['arrMatches'][$i];
                                $match['DatetimeHappen'] = 7 * 3600 + $match['DatetimeHappen'];
                            ?>
                            <li <?php if ($i == $numMatches - 1) echo 'class="end"' ?>>
                                <div class="time w80 left txt_gray">
                                <?php 
                                    if ($this->currTime > 10800 + $match['DatetimeHappen']) // Greater than 3 hours
                                        echo 'KT';
                                    else if ($this->currTime > $match['DatetimeHappen'] && $this->currTime <= 10800 + $match['DatetimeHappen'])
                                        echo 'ĐDR';
                                    else
                                        echo date('H:i', $match['DatetimeHappen']); 
                                ?>
                                </div>
                                <div class="capdau">
                                    <div class="w230 left"> 
                                        <img onerror="this.src='<?php echo $this->Imageurl('notfound.jpg', $this->imageSize['size6']); ?>'" src="<?php echo $this->displayLogoTeam($match['Team1']); ?>"  alt="<?php echo $this->displayTeamName($match['Team1']); ?>" class="right" />
                                        <span class="right"><?php echo $this->displayTeamName($match['Team1']); ?></span>
                                    </div>
                                    <div class="w50 left txt_center txt_gray"> 
                                        <?php 
                                        if ($this->currTime > $match['DatetimeHappen'])
                                            echo "{$match['Goal1']} - {$match['Goal2']}";
                                        else
                                            echo ' v ';
                                        ?>
                                    </div>
                                    <div class="w230 left"> 
                                        <img onerror="this.src='<?php echo $this->Imageurl('notfound.jpg', $this->imageSize['size6']); ?>'" src="<?php echo $this->displayLogoTeam($match['Team2']); ?>"  alt="<?php echo $this->displayTeamName($match['Team2']); ?>" class="left" />
                                        <span class="left"><?php echo $this->displayTeamName($match['Team2']); ?></span>
                                    </div>
                                </div>
                                <div class="box_width_common txt_link_thongtin_capdau">
                                    <p>
                                        <a href="#" class="txt_gray">Thông tin trước trận đấu</a> &nbsp; | &nbsp;  <a href="#" class="txt_gray">Trực tiếp</a> &nbsp; | &nbsp; <a href="#" class="txt_gray">Đánh giá cầu thủ</a> &nbsp; | &nbsp; <a href="#" class="txt_gray">Video</a> 
                                    </p>
                                </div>
                            </li>
                            <?php } ?>
                        </ul>

                    </div>
                    <div class="clear">&nbsp;</div>
                </div>
            </div>
        </div>
        <div class="clear">&nbsp;</div>
    </div>
    <?php 
        }
    }else{ 
    ?>
    <div class="content_cate">
        Hiện tại không có thông tin lịch thi đấu.
    </div>
    <?php } ?>
</div>
<?php 
}
if ($this->group == NULL || $this->group == 'trong-nuoc'){
?>
<div id="cate_bongdatrongnuoc" class="football box_width_common">
    <div class="title_cate">
        <p class="left">Bóng đá trong nước</p>
        <div class="right selec_cate">
            <select id="trong-nuoc" onchange="fixture.changeLeague(this.value, this.id);" class="left w150">
                <option value="0" <?php if($this->leagueId == 0) echo 'selected="selected"'; ?>>Tất cả giải đấu</option>
                <?php 
                if (is_array($this->arrListLeagueTN) && count($this->arrListLeagueTN)){
                foreach ($this->arrListLeagueTN as $leagueId => $leagueName){ ?>
                <option value="<?php echo $leagueId; ?>" <?php if($this->leagueId == $leagueId) echo 'selected="selected"'; ?>><?php echo $leagueName; ?></option>
                <?php }} ?>
            </select>
        </div>
    </div>
    <?php 
    if (is_array($groupTN) && count($groupTN)){
        foreach($groupTN as $group){
    ?>
    <div class="content_cate">
        <div class="block_lichthidau box_width_common left">
            <div class="title_block">
                <div class="txt_title_left_block"><h3><a href="javascript:;" onclick="fixture.changeLeague(<?php echo $group['LeagueID']?>, 'trong-nuoc');" class="txt_black_hover_blue"><?php echo $group['Name'];?></a></h3></div>
                <div class="txt_view_more"><a class="txt_gray" href="<?php echo BASE_URL, '/bang-xep-hang/', Fpt_Filter::setSeoLink($group['Name']),'-', Fpt_Filter::setSeoLink($group['SeasonName']), '-', $group['LeagueID'], '-', $group['SeasonID'], '.html'?>">Bảng xếp hạng</a> <span class="icon_portal_thethao icon_view_more">&nbsp;</span></div>	
                <div class="clear">&nbsp;</div>  
            </div>
            <div class="content_block">
                <div class="main_content_block">
                    <div class="lichthidau_item box_width_common">
                        <ul class="list_capdau">
                            <?php 
                            $numMatches = count($group['arrMatches']);
                            for($i = 0; $i < $numMatches; $i++){
                                $match = $group['arrMatches'][$i];
                            ?>
                            <li <?php if ($i == $numMatches - 1) echo 'class="end"' ?>>
                                <div class="time w80 left txt_gray"><?php echo date('H:i', $match['DatetimeHappen']); ?></div>
                                <div class="capdau">
                                    <div class="w230 left"> 
                                        <img onerror="this.src='<?php echo $this->Imageurl('notfound.jpg', $this->imageSize['size6']); ?>'" src="<?php echo $this->displayLogoTeam($match['Team1']); ?>" alt="<?php echo $this->displayTeamName($match['Team1']); ?>" class="right" />
                                        <span class="right"><?php echo $this->displayTeamName($match['Team1']); ?></span>
                                    </div>
                                    <div class="w50 left txt_center txt_gray">
                                        <?php 
                                        if ($this->currTime > $match['DatetimeHappen'])
                                            echo "{$match['Goal1']} - {$match['Goal2']}";
                                        else
                                            echo ' v ';
                                        ?>
                                    </div>
                                    <div class="w230 left"> 
                                        <img onerror="this.src='<?php echo $this->Imageurl('notfound.jpg', $this->imageSize['size6']); ?>'" src="<?php echo $this->displayLogoTeam($match['Team2']); ?>" alt="<?php echo $this->displayTeamName($match['Team2']); ?>" class="left" />
                                        <span class="left"><?php echo $this->displayTeamName($match['Team2']); ?></span></div>
                                </div>
                                <div class="box_width_common txt_link_thongtin_capdau">
                                    <p>
                                        <a href="#" class="txt_gray">Thông tin trước trận đấu</a> &nbsp; | &nbsp;  <a href="#" class="txt_gray">Trực tiếp</a> &nbsp; | &nbsp; <a href="#" class="txt_gray">Đánh giá cầu thủ</a> &nbsp; | &nbsp; <a href="#" class="txt_gray">Video</a> 
                                    </p>
                                </div>
                            </li>
                            <?php } ?>
                        </ul>
                    </div>
                    <div class="clear">&nbsp;</div>
                </div>
            </div>
        </div>
        <div class="clear">&nbsp;</div>
    </div>
    <?php 
        }
    }else{
    ?>
    <div class="content_cate">
        <div class="content_block txt_center txt_nocontent">
        Không có trận đấu trong ngày hôm nay
        </div>
    </div>
    <?php } ?>
</div>
<?php } ?>